home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / program / misc / fpl-v13.lha / fpl / src / debug.c < prev    next >
C/C++ Source or Header  |  1995-07-13  |  4KB  |  92 lines

  1. /******************************************************************************
  2.  *              FREXX PROGRAMMING LANGUAGE                  *
  3.  ******************************************************************************
  4.  
  5.  Debug.c
  6.  
  7.  Routines only part of debug versions
  8.  
  9.  *****************************************************************************/
  10.  
  11. /************************************************************************
  12.  *                                                                      *
  13.  * fpl.library - A shared library interpreting script langauge.         *
  14.  * Copyright (C) 1992-1994 FrexxWare                                    *
  15.  * Author: Daniel Stenberg                                              *
  16.  *                                                                      *
  17.  * This program is free software; you may redistribute for non          *
  18.  * commercial purposes only. Commercial programs must have a written    *
  19.  * permission from the author to use FPL. FPL is *NOT* public domain!   *
  20.  * Any provided source code is only for reference and for assurance     *
  21.  * that users should be able to compile FPL on any operating system     *
  22.  * he/she wants to use it in!                                           *
  23.  *                                                                      *
  24.  * You may not change, resource, patch files or in any way reverse      *
  25.  * engineer anything in the FPL package.                                *
  26.  *                                                                      *
  27.  * This program is distributed in the hope that it will be useful,      *
  28.  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
  29.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                 *
  30.  *                                                                      *
  31.  * Daniel Stenberg                                                      *
  32.  * Ankdammsgatan 36, 4tr                                                *
  33.  * S-171 43 Solna                                                       *
  34.  * Sweden                                                               *
  35.  *                                                                      *
  36.  * FidoNet 2:201/328    email:dast@sth.frontec.se                       *
  37.  *                                                                      *
  38.  ************************************************************************/
  39.  
  40. #if defined(AMIGA) && defined(DEBUGMAIL)
  41. #include "script.h"
  42.  
  43. #include <exec/execbase.h>
  44. #include <exec/types.h>
  45. #include <exec/ports.h>
  46. #include <pragmas/exec_sysbase_pragmas.h>
  47. #include <clib/exec_protos.h>
  48.  
  49. #include "/debug/debugmail.h"
  50.  
  51. void REGARGS
  52. DebugMail(struct Data *scr, MailSubj flag, long data2, void *data)
  53. {
  54.   struct ExecBase *SysBase = *(struct ExecBase **)4;
  55.   struct Messy mess;
  56.   struct MsgPort *port;
  57.   if(scr->flags&FPLDATA_DEBUG) {
  58.     Forbid();
  59.     port=FindPort(MSGPORT_NAME);
  60.     if (port) {
  61.       struct MsgPort *answerport;
  62.       answerport=CreateMsgPort();
  63.       if (answerport) {
  64.         mess.mess.mn_Length=sizeof(struct Messy);
  65.         mess.mess.mn_ReplyPort=answerport;
  66.         mess.scr = scr; /* give them the world of FPL! */
  67.         mess.flag = flag;
  68.         switch(flag) {
  69.         case MAIL_START:
  70.         case MAIL_EXIT:
  71.           mess.data = NULL;
  72.           break;
  73.         default:
  74.           mess.data = data;
  75.         }
  76.         mess.data2 = (void *)data2;
  77.         PutMsg(port, (struct Message *)&mess);
  78.         Permit();
  79.         WaitPort(answerport);
  80.         DeleteMsgPort(answerport);
  81.         /* Message sent */
  82.       } else {
  83.         Permit();
  84.       }
  85.     } else {
  86.       Permit();
  87.     }
  88.   }
  89. }
  90.  
  91. #endif
  92.